#include <iostream>
#define N 100

//
using namespace std;

int new_array(int array_a[], int array_b[], int elements_a, int elements_b){
int i,j,k,l;
int elements_c = elements_a < elements_b ? elements_b : elements_a;
int array_c[elements_c];

if(elements_a>elements_b){
	k = elements_b;
	for(i=0;i<k;i++)
		array_c[i] = array_a[i] + array_b[i];
	for(; i < elements_c; ++i)
		array_c[i] = array_a[i];
}
else{
    k = elements_a;
	for(i=0;i<k;i++)
		array_c[i] = array_a[i] + array_b[i];
	for(; i < elements_c; ++i)
		array_c[i] = array_b[i];
}



for(i=0;i<elements_c;i++)
    cout<<array_c[i]<<" ";

}

void readintVector_A(int array_a[], int elements_a){
for (int i=0; i<elements_a; i++){
	cout<<"a["<<i<<"]=";
	cin>>array_a[i];
	cout<<"\n";}
}

void readintVector_B(int array_b[], int elements_b){
for (int i=0; i<elements_b; i++){
	cout<<"a["<<i<<"]=";
	cin>>array_b[i];
	cout<<"\n";}
}

void printintVector(int array[], int elements){
for(int i=0; i<elements; i++){
	cout<<array[i]<<" ";}
	cout<<"\n";
}


int main(){
int array_a[N];
int array_b[N];

int elements_a;
int elements_b;

cout<<"Type the number of elements you want in the array A: ";
cin>>elements_a;
readintVector_A(array_a, elements_a);

cout<<"Type the number of elements you want in array B: ";
cin>> elements_b;
readintVector_B(array_b, elements_b);

cout<<"The original array A is ";
for(int i=0; i<elements_a; i++){
	cout<<array_a[i]<<" ";}
cout<<endl;

cout<<"The original array B is ";
for(int i=0; i<elements_b; i++){
	cout<<array_b[i]<<" ";}
cout<<endl;


new_array(array_a, array_b, elements_a, elements_b);


return 0;
}
